public class Stack<Element> {
    Element head;
    Stack<Element> tail;
    int height;
    
    public Stack(Element head, Stack<Element> tail) {
        this.head = head;
        this.tail = tail;
        if(tail == null) height = 0;
        else height = 1 + tail.height;
    }
}
